home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / Mesa-3.0 / SRC / FX / FXDD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-24  |  16.2 KB  |  595 lines

  1. /* -*- mode: C; tab-width:8;  -*-
  2.  
  3.              fxdd.c - 3Dfx VooDoo Mesa device driver functions
  4. */
  5.  
  6. /*
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Library General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Library General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Library General Public
  18.  * License along with this library; if not, write to the Free
  19.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  * See the file fxapi.c for more informations about authors
  22.  *
  23.  */
  24.  
  25.  
  26. #if defined(FX)
  27.  
  28. #include "fxdrv.h"
  29.  
  30. /**********************************************************************/
  31. /*****                 Miscellaneous functions                    *****/
  32. /**********************************************************************/
  33.  
  34. /* Enalbe/Disable dithering */
  35. void fxDDDither(GLcontext *ctx, GLboolean enable)
  36. {
  37. #if defined(DEBUG_FXMESA)
  38.   fprintf(stderr,"fxmesa: fxDDDither()\n");
  39. #endif
  40.  
  41.   if(enable)
  42.     grDitherMode(GR_DITHER_4x4);
  43.   else
  44.     grDitherMode(GR_DITHER_DISABLE);
  45. }
  46.  
  47.  
  48. /* Return buffer size information */
  49. void fxDDBufferSize(GLcontext *ctx, GLuint *width, GLuint *height)
  50. {
  51.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  52.  
  53. #if defined(DEBUG_FXMESA)
  54.   fprintf(stderr,"fxmesa: fxDDBufferSize(...) Start\n");
  55. #endif
  56.  
  57.   *width=fxMesa->width;
  58.   *height=fxMesa->height;
  59.  
  60. #if defined(DEBUG_FXMESA)
  61.   fprintf(stderr,"fxmesa: fxDDBufferSize(...) End\n");
  62. #endif
  63. }
  64.  
  65.  
  66. /* Set current drawing color */
  67. static void fxDDSetColor(GLcontext *ctx, GLubyte red, GLubyte green,
  68.              GLubyte blue, GLubyte alpha )
  69. {
  70.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  71.  
  72. #if defined(DEBUG_FXMESA)
  73.   fprintf(stderr,"fxmesa: fxDDSetColor(%d,%d,%d,%d)\n",red,green,blue,alpha);
  74. #endif
  75.  
  76.   fxMesa->color=FXCOLOR(red,green,blue,alpha);
  77. }
  78.  
  79.  
  80. /* Implements glClearColor() */
  81. static void fxDDClearColor(GLcontext *ctx, GLubyte red, GLubyte green,
  82.                GLubyte blue, GLubyte alpha )
  83. {
  84.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  85.  
  86. #if defined(DEBUG_FXMESA)
  87.   fprintf(stderr,"fxmesa: fxDDClearColor(%d,%d,%d,%d)\n",red,green,blue,alpha);
  88. #endif
  89.  
  90.   fxMesa->clearC=FXCOLOR(red,green,blue,255);
  91.   fxMesa->clearA=alpha;
  92. }
  93.  
  94.  
  95. /* Clear the color and/or depth buffers */
  96. static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
  97.                 GLint x, GLint y, GLint width, GLint height )
  98. {
  99.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  100.   GLbitfield newmask;
  101.  
  102. #if defined(DEBUG_FXMESA)
  103.   fprintf(stderr,"fxmesa: fxDDClear(%d,%d,%d,%d)\n",x,y,width,height);
  104. #endif
  105.  
  106.   switch(mask & (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)) {
  107.   case (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT):
  108.     /* clear color and depth buffer */
  109.  
  110.     grDepthMask(FXTRUE);
  111.     grColorMask(FXTRUE,FXFALSE);
  112.  
  113.     if(ctx->RasterMask & FRONT_AND_BACK_BIT) {
  114.       grRenderBuffer(GR_BUFFER_BACKBUFFER);
  115.       grBufferClear(fxMesa->clearC, fxMesa->clearA,
  116.             (FxU16)(ctx->Depth.Clear*0xffff));
  117.       grRenderBuffer(GR_BUFFER_FRONTBUFFER);
  118.  
  119.     }
  120.     grBufferClear(fxMesa->clearC, fxMesa->clearA,
  121.           (FxU16)(ctx->Depth.Clear*0xffff));
  122.  
  123.     if(!ctx->Depth.Mask)
  124.       grDepthMask(FXFALSE);
  125.     if(ctx->Color.ColorMask)
  126.       grColorMask(FXTRUE,FXFALSE);
  127.     else
  128.       grColorMask(FXFALSE,FXFALSE);
  129.  
  130.     newmask=mask & (~(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT));
  131.     break;
  132.   case (GL_COLOR_BUFFER_BIT):
  133.     /* clear color buffer */
  134.     grDepthMask(FXFALSE);
  135.     grColorMask(FXTRUE,fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
  136.  
  137.     if(ctx->RasterMask & FRONT_AND_BACK_BIT) {
  138.       grRenderBuffer(GR_BUFFER_BACKBUFFER);
  139.       grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
  140.       grRenderBuffer(GR_BUFFER_FRONTBUFFER);
  141.     
  142.     }
  143.     grBufferClear(fxMesa->clearC, fxMesa->clearA, 0);
  144.  
  145.     if(ctx->Depth.Mask)
  146.       grDepthMask(FXTRUE);
  147.     if(ctx->Color.ColorMask)
  148.       grColorMask(FXTRUE,fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
  149.     else
  150.       grColorMask(FXFALSE,FXFALSE);
  151.  
  152.     newmask=mask & (~(GL_COLOR_BUFFER_BIT));
  153.     break;
  154.   case (GL_DEPTH_BUFFER_BIT):
  155.     /* clear depth buffer */
  156.     grDepthMask(FXTRUE);
  157.     grColorMask(FXFALSE,FXFALSE);
  158.     grBufferClear(fxMesa->clearC, fxMesa->clearA,
  159.           (FxU16)(ctx->Depth.Clear*0xffff));
  160.     if(!ctx->Depth.Mask)
  161.       grDepthMask(FXFALSE);
  162.     if(ctx->Color.ColorMask)
  163.       grColorMask(FXTRUE,FXFALSE);
  164.  
  165.     newmask=mask & (~(GL_DEPTH_BUFFER_BIT));
  166.     break;
  167.   default:
  168.     newmask=mask;
  169.     break;
  170.   }
  171.    
  172.   return newmask;
  173. }
  174.  
  175.  
  176. /*  Set the buffer used in double buffering */
  177. static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode )
  178. {
  179.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  180.  
  181. #if defined(DEBUG_FXMESA)
  182.   fprintf(stderr,"fxmesa: fxDDSetBuffer(%x)\n",mode);
  183. #endif
  184.  
  185.   if(fxMesa->haveDoubleBuffer) {
  186.     if((mode==GL_FRONT) || (mode==GL_FRONT_AND_BACK))
  187.       fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
  188.     else if(mode==GL_BACK)
  189.       fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
  190.     else
  191.       return GL_FALSE;
  192.   } else {
  193.     if(mode==GL_FRONT)
  194.       fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
  195.     else
  196.       return GL_FALSE;
  197.   }
  198.  
  199.   grRenderBuffer(fxMesa->currentFB);
  200.  
  201.   return GL_TRUE;
  202. }
  203.  
  204.  
  205. static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py,
  206.                 GLsizei width, GLsizei height,
  207.                 const struct gl_pixelstore_attrib *unpack,
  208.                 const GLubyte *bitmap)
  209. {
  210.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  211.   FxU16 *p;
  212.   GrLfbInfo_t info;
  213.   const GLubyte *pb;
  214.   int x,y;
  215.   GLint r,g,b,a,scrwidth,scrheight,stride;
  216.   FxU16 color;
  217.  
  218.   /* TODO: with a little work, these bitmap unpacking parameter restrictions
  219.    * could be removed.
  220.    */
  221.   if((unpack->Alignment!=1) ||
  222.      (unpack->RowLength!=0) ||
  223.      (unpack->SkipPixels!=0) ||
  224.      (unpack->SkipRows!=0) ||
  225.      (unpack->SwapBytes) ||
  226.      (unpack->LsbFirst))
  227.      return GL_FALSE;
  228.  
  229. #define ISCLIPPED(rx) ( ((rx)<0) || ((rx)>=scrwidth) )
  230. #define DRAWBIT(i) {       \
  231.   if(!ISCLIPPED(x+px))       \
  232.     if( (*pb) & (1<<(i)) ) \
  233.       (*p)=color;       \
  234.   p++;                     \
  235.   x++;               \
  236.   if(x>=width) {           \
  237.     pb++;                  \
  238.     break;                 \
  239.   }                        \
  240. }
  241.  
  242.   scrwidth=fxMesa->width;
  243.   scrheight=fxMesa->height;
  244.  
  245.   if((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0))
  246.     return GL_TRUE;
  247.  
  248.   pb=bitmap;
  249.  
  250.   if(py<0) {
  251.     pb+=(height*(-py)) >> (3+1);
  252.     height+=py;
  253.     py=0;
  254.   }
  255.  
  256.   if(py+height>=scrheight)
  257.     height-=(py+height)-scrheight;
  258.  
  259.   info.size=sizeof(info);
  260.   if(!grLfbLock(GR_LFB_WRITE_ONLY,
  261.         fxMesa->currentFB,
  262.         GR_LFBWRITEMODE_565,
  263.         GR_ORIGIN_UPPER_LEFT,
  264.         FXFALSE,
  265.         &info)) {
  266. #ifndef FX_SILENT
  267.     fprintf(stderr,"fx Driver: error locking the linear frame buffer\n");
  268. #endif
  269.     return GL_TRUE;
  270.   }
  271.  
  272.   r=(GLint)(ctx->Current.RasterColor[0]*255.0f);
  273.   g=(GLint)(ctx->Current.RasterColor[1]*255.0f);
  274.   b=(GLint)(ctx->Current.RasterColor[2]*255.0f);
  275.   a=(GLint)(ctx->Current.RasterColor[3]*255.0f);
  276.   color=(FxU16)
  277.     ( ((FxU16)0xf8 & b) <<(11-3))  |
  278.     ( ((FxU16)0xfc & g) <<(5-3+1)) |
  279.     ( ((FxU16)0xf8 & r) >> 3);
  280.  
  281.   stride=info.strideInBytes>>1;
  282.  
  283.   /* This code is a bit slow... */
  284.  
  285.   for(y=0;y<height;y++) {
  286.     p=((FxU16 *)info.lfbPtr)+px+((scrheight-(y+py))*stride);
  287.  
  288.     for(x=0;;) {
  289.       DRAWBIT(7);    DRAWBIT(6);    DRAWBIT(5);    DRAWBIT(4);
  290.       DRAWBIT(3);    DRAWBIT(2);    DRAWBIT(1);    DRAWBIT(0);
  291.       pb++;
  292.     }
  293.   }
  294.  
  295.   grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
  296.  
  297. #undef ISCLIPPED
  298. #undef DRAWBIT
  299.  
  300.   return GL_TRUE;
  301. }
  302.  
  303. static void fxDDFinish(GLcontext *ctx)
  304. {
  305.   grSstIdle();
  306. }
  307.  
  308.  
  309. static GLint fxDDGetParameteri(const GLcontext *ctx, GLint param)
  310. {
  311.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  312.  
  313.   switch(param) {
  314.   case DD_MAX_TEXTURE_SIZE:
  315.     return 256;
  316.   case DD_MAX_TEXTURES:
  317.     if(fxMesa->haveTwoTMUs)
  318.       return 2;
  319.     else
  320.       return 1;
  321.   case DD_HAVE_HARDWARE_FOG:
  322.     return 1;
  323.   case DD_MAX_TEXTURE_COORD_SETS:
  324.     return MAX_TEX_COORD_SETS;
  325.   default:
  326.     fprintf(stderr,"fx Driver: internal error in fxDDGetParameteri(): %x\n",param);
  327.     fxCloseHardware();
  328.     exit(-1);
  329.   }
  330. }
  331.  
  332.  
  333. void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
  334. {
  335.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  336.  
  337. #if defined(DEBUG_FXMESA)
  338.   fprintf(stderr,"fxmesa: fxDDSetNearFar(%f,%f)\n",n,f);
  339. #endif
  340.  
  341.   if(fxMesa) {
  342.     if(ctx->NewProjectionMatrix)
  343.       gl_analyze_projection_matrix(ctx);
  344.  
  345.     if((ctx->ProjectionMatrixType==MATRIX_ORTHO || 
  346.     ctx->ProjectionMatrixType==MATRIX_IDENTITY)
  347.        && ctx->ModelViewMatrixType!=MATRIX_GENERAL
  348.        && (ctx->VB->VertexSizeMask & VERTEX4_BIT)==0)
  349.       fxMesa->wScale=1.0f;
  350.     else
  351.       fxMesa->wScale=fabs(f)/65535.0f;
  352.  
  353.     /*
  354.      * We need to update fog table because it depends on w 
  355.      * and w is adjusted to the maximum range.
  356.      */
  357.  
  358.     fxSetupFog(ctx);
  359.   }
  360. }
  361.  
  362.  
  363. static const char *fxDDRendererString(void)
  364. {
  365.   static char buf[MAX_NUM_SST][64];
  366.  
  367.   fxQueryHardware();
  368.  
  369.   if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO)
  370.     sprintf(buf[glbCurrentBoard],"Glide v0.29 Voodoo_Graphics %d CARD/%d FB/%d TM/%d TMU/%s",
  371.         glbCurrentBoard,
  372.  
  373.         (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ?
  374.          (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam*2) :
  375.          glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam),
  376.  
  377.         glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.tmuConfig[GR_TMU0].tmuRam+
  378.         ((glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx>1) ?
  379.          glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.tmuConfig[GR_TMU1].tmuRam :
  380.          0),
  381.  
  382.         glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx,
  383.  
  384.         (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ? "SLI" : "NOSLI")
  385.         );
  386.   else {
  387.     if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96)
  388.       sprintf(buf[glbCurrentBoard],"Glide v0.29 Voodoo_Rush %d CARD/%d FB/%d TM/%d TMU/NOSLI",
  389.           glbCurrentBoard,
  390.  
  391.           glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.fbRam,
  392.           
  393.           glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.tmuConfig.tmuRam,
  394.  
  395.           glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx          
  396.           );
  397.     else
  398.       strcpy(buf[glbCurrentBoard],"Glide v0.29 UNKNOWN");
  399.   }
  400.  
  401.   return buf[glbCurrentBoard];
  402. }
  403.  
  404.  
  405. static const char *fxDDExtensionsString(GLcontext *ctx)
  406. {
  407.   static char *extensions="GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture GL_EXT_multitexture 3DFX_set_global_palette GL_FXMESA_global_texture_lod_bias";
  408.  
  409.   return extensions;
  410. }
  411.  
  412. /************************************************************************/
  413. /************************************************************************/
  414. /************************************************************************/
  415.  
  416. /* This is a no-op, since the z-buffer is in hardware */
  417. static void fxAllocDepthBuffer(GLcontext *ctx)
  418. {
  419. #if defined(DEBUG_FXMESA)
  420.   fprintf(stderr,"fxmesa: fxAllocDepthBuffer()\n");
  421. #endif
  422. }
  423.  
  424. /************************************************************************/
  425. /************************************************************************/
  426. /************************************************************************/
  427.  
  428. /* Check if the hardware supports the current context */
  429. static GLboolean fxIsInHardware(GLcontext *ctx)
  430. {
  431.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  432.  
  433.   if((ctx->RasterMask & STENCIL_BIT) ||
  434.      ((ctx->Color.BlendEnabled) && (ctx->Color.BlendEquation!=GL_FUNC_ADD_EXT)) ||
  435.      ((ctx->Color.ColorLogicOpEnabled) && (ctx->Color.LogicOp!=GL_COPY)) ||
  436.      (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) ||
  437.      (!((ctx->Color.ColorMask[0]==ctx->Color.ColorMask[1]) &&
  438.     (ctx->Color.ColorMask[1]==ctx->Color.ColorMask[2]) &&
  439.     (ctx->Color.ColorMask[2]==ctx->Color.ColorMask[3])))
  440.      )
  441.     return GL_FALSE;
  442.  
  443.   /* Unsupported texture/multitexture cases */
  444.  
  445.   if(fxMesa->haveTwoTMUs) {
  446.     if((ctx->Texture.Enabled & (TEXTURE0_3D | TEXTURE1_3D)) ||
  447.        /* Not very well written ... */
  448.        ((ctx->Texture.Enabled & (TEXTURE0_1D | TEXTURE1_1D)) && 
  449.     ((ctx->Texture.Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D)))
  450.        )
  451.       return GL_FALSE;
  452.  
  453.     if((ctx->Texture.Enabled & TEXTURE0_2D) &&
  454.        ctx->Texture.Set[0].Current2D->Complete &&
  455.        (ctx->Texture.Set[0].EnvMode==GL_BLEND))
  456.       return GL_FALSE;
  457.  
  458.     if((ctx->Texture.Enabled & TEXTURE1_2D) &&
  459.        ctx->Texture.Set[1].Current2D->Complete &&
  460.        (ctx->Texture.Set[1].EnvMode==GL_BLEND))
  461.       return GL_FALSE;
  462.  
  463.     if((ctx->Texture.Enabled & (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D)) &&
  464.        (ctx->Texture.Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) &&
  465.        ((ctx->Texture.Set[0].EnvMode!=GL_MODULATE) ||
  466.     (ctx->Texture.Set[1].EnvMode!=GL_MODULATE)))
  467.       return GL_FALSE;
  468.   } else {
  469.     if((ctx->Texture.Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) ||
  470.        /* Not very well written ... */
  471.        ((ctx->Texture.Enabled & TEXTURE0_1D) && 
  472.     (!(ctx->Texture.Enabled & TEXTURE0_2D)))
  473.        )
  474.       return GL_FALSE;
  475.  
  476.     
  477.     if((ctx->Texture.Enabled & TEXTURE0_2D) &&
  478.        ctx->Texture.Set[0].Current2D->Complete &&
  479.        (ctx->Texture.Set[0].EnvMode==GL_BLEND))
  480.       return GL_FALSE;
  481.   }
  482.  
  483.   return GL_TRUE;
  484. }
  485.  
  486. static void fxDDUpdateDDPointers(GLcontext *ctx)
  487. {
  488.   fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
  489.  
  490. #if defined(DEBUG_FXMESA)
  491.   fprintf(stderr,"fxmesa: fxDDUpdateDDPointers(...)\n");
  492. #endif
  493.  
  494.   if(fxIsInHardware(ctx)) {
  495.     /* acc. functions */
  496.  
  497.     if(ctx->NewState==NEW_DRVSTATE0) {
  498.       /* Only texture changed */
  499.       fxSetupTexture(ctx);
  500.  
  501.       ctx->Driver.PointsFunc=fxMesa->PointsFunc;
  502.       ctx->Driver.LineFunc=fxMesa->LineFunc;
  503.       ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
  504.       ctx->Driver.QuadFunc=fxMesa->QuadFunc;
  505.       ctx->Driver.RenderVB=fxMesa->RenderVB;
  506.     } else {
  507.       fxSetupFXUnits(ctx);
  508.  
  509.       ctx->Driver.PointsFunc=fxMesa->PointsFunc=fxDDChoosePointsFunction(ctx);
  510.       ctx->Driver.LineFunc=fxMesa->LineFunc=fxDDChooseLineFunction(ctx);
  511.       ctx->Driver.TriangleFunc=fxMesa->TriangleFunc=fxDDChooseTriangleFunction(ctx);
  512.       ctx->Driver.QuadFunc=fxMesa->QuadFunc=fxDDChooseQuadFunction(ctx);
  513.       ctx->Driver.RenderVB=fxMesa->RenderVB=fxDDChooseRenderVBFunction(ctx);
  514.     }
  515.  
  516.     ctx->Driver.RasterSetup=fxDDChooseSetupFunction(ctx);
  517.   } else {
  518.     ctx->Driver.PointsFunc=NULL;
  519.     ctx->Driver.LineFunc=NULL;
  520.     ctx->Driver.TriangleFunc=NULL;
  521.     ctx->Driver.QuadFunc=NULL;
  522.     ctx->Driver.RenderVB=NULL;
  523.     ctx->Driver.RasterSetup=NULL;
  524.   }
  525.  
  526.   ctx->Driver.AllocDepthBuffer=fxAllocDepthBuffer;
  527.  
  528.   fxUpdateDDSpanPointers(ctx);
  529. }
  530.  
  531.  
  532. void fxSetupDDPointers(GLcontext *ctx)
  533. {
  534. #if defined(DEBUG_FXMESA)
  535.   fprintf(stderr,"fxmesa: fxSetupDDPointers()\n");
  536. #endif
  537.  
  538.   ctx->Driver.UpdateState=fxDDUpdateDDPointers;
  539.          
  540.   ctx->Driver.RendererString=fxDDRendererString;
  541.   ctx->Driver.ExtensionString=fxDDExtensionsString;
  542.  
  543.   ctx->Driver.Dither=fxDDDither;
  544.  
  545.   ctx->Driver.NearFar=fxDDSetNearFar;
  546.  
  547.   ctx->Driver.GetParameteri=fxDDGetParameteri;
  548.  
  549.   ctx->Driver.ClearIndex=NULL;
  550.   ctx->Driver.ClearColor=fxDDClearColor;
  551.   ctx->Driver.Clear=fxDDClear;
  552.  
  553.   ctx->Driver.Index=NULL;
  554.   ctx->Driver.Color=fxDDSetColor;
  555.  
  556.   ctx->Driver.SetBuffer=fxDDSetBuffer;
  557.   ctx->Driver.GetBufferSize=fxDDBufferSize;
  558.  
  559.   ctx->Driver.Bitmap=fxDDDrawBitMap;
  560.   ctx->Driver.DrawPixels=NULL;
  561.  
  562.   ctx->Driver.Finish=fxDDFinish;
  563.   ctx->Driver.Flush=NULL;
  564.  
  565.   ctx->Driver.TexEnv=fxDDTexEnv;
  566.   ctx->Driver.TexImage=fxDDTexImg;
  567.   ctx->Driver.TexSubImage=fxDDTexSubImg;
  568.   ctx->Driver.TexParameter=fxDDTexParam;
  569.   ctx->Driver.BindTexture=fxDDTexBind;
  570.   ctx->Driver.DeleteTexture=fxDDTexDel;
  571.   ctx->Driver.UpdateTexturePalette=fxDDTexPalette;
  572.   ctx->Driver.UseGlobalTexturePalette=fxDDTexUseGlbPalette;
  573.  
  574.   ctx->Driver.RectFunc=NULL;
  575.  
  576.   fxSetupDDSpanPointers(ctx);
  577.  
  578.   fxDDUpdateDDPointers(ctx);
  579. }
  580.  
  581.  
  582. #else
  583.  
  584.  
  585. /*
  586.  * Need this to provide at least one external definition.
  587.  */
  588.  
  589. int gl_fx_dummy_function_dd(void)
  590. {
  591.   return 0;
  592. }
  593.  
  594. #endif  /* FX */
  595.